package com.chaopei.customer_server;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

import java.util.logging.Logger;

@EnableDiscoveryClient
@SpringBootApplication
public class CustomerServerApplication {
    static Logger log = Logger.getLogger("consumer");
    public static void main(String[] args) {
        SpringApplication.run(CustomerServerApplication.class, args);
        log.info("消费者已启动...");
    }

    /*通过注解的方式声明一个bean*/
    @Bean
    //配置负载均衡器
    @LoadBalanced
    public RestTemplate restTemplate(){
        return  new RestTemplate();
    }
}
